package codetop.greedy;

public class Code055 {
    public boolean canJump(int[] nums) {
       boolean dp[]=new boolean[nums.length];
       dp[nums.length-1]=true;
        for (int i = nums.length-2; i >=0 ; i--) {
            int step=nums[i];
            for (int j = 0; j < step; j++) {
                if (i+step<nums.length&&dp[i+step]==true){
                    dp[i]=true;
                    break;
                }
            }
        }
        return dp[0];
    }
}
